package fr.anime.view;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.ScrollPaneConstants;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.xml.ws.handler.MessageContext.Scope;

public class FilesView extends JPanel {

	private JComboBox driveSelection;
	private JTree fileTree;
	
	
	public FilesView() {
		System.out.println("coucou filesview");

		driveSelection = new JComboBox();
		
		final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
		fileTree = new JTree(root);
		driveSelection.setPreferredSize(new Dimension(100,20));
		
		//fileTree.setPreferredSize(new Dimension(500, 400));
		
		this.setLayout(new BorderLayout());
		this.add(driveSelection, BorderLayout.NORTH);

		JScrollPane scrollTree = new JScrollPane(fileTree);
		scrollTree.setPreferredSize(new Dimension(1000, 1000));
		this.add(scrollTree, BorderLayout.CENTER);	
		
		

	}
	
	public JComboBox getDriveSelection() {
		return this.driveSelection;
	}
	
	public JTree getJtree() {
		return this.fileTree;
	}
	
	public void buildTree(DefaultMutableTreeNode treeRoot) {
		//DefaultTreeModel treeModel = new DefaultTreeModel(treeRoot);
		((DefaultTreeModel) this.fileTree.getModel()).setRoot(treeRoot);
		//this.fileTree.setModel(treeModel);
		this.validate();
		this.repaint();
	}

	
}
